//
//  UILabel+Extention.swift
//  weibo
//
//  Created by 王向宁 on 16/5/24.
//  Copyright © 2016年 王向宁. All rights reserved.
//

import UIKit

extension UILabel {
    
    //给uilabel添加一个遍历的构造函数
    convenience init(title: String,font: CGFloat,textColor:UIColor,alignment:NSTextAlignment = .Center) {
        //调用指定的构造函数,实例化对象
        self.init()
        
        self.text = title
        
        self.font = UIFont.systemFontOfSize(font)
        
        self.textColor = textColor
        
        textAlignment = alignment
        
        if alignment == .Left {
            //设置最大布局宽度
            preferredMaxLayoutWidth = ScreenWidth - 2 * StatusCellMargin
        }
        
        numberOfLines = 0
        
        sizeToFit()
        
    }
}
